Search Results: "Mario Lang"

18 February 2014

Mario Lang: Contributing on GitHub

I really like to read code written by different people. I've always been the type of learner that can cover a lot of ground by looking at examples. A few of the programming tricks I acquired over time have definitely been learnt by reading programs written by other people. There are of course cases of disagrement with coding style (lets put that very mildly), so not every project is fun to read. But I tend to find projects I like enough to actually look at their source code. Now, if you get into this habit, there is also the occasional spotting of a bug. Many are really cosmetic, like typos in comments or documentation. Others are maybe more serious, who knows what can happen if you read a few lines of code written by someone you have never met in person. This is one of the original arguments of open source and free software. It basically goes like: "People will read your code and report problems." I know that happens, but I also know that there are cases of people finding relatively minor things during a small code review, which they don't report, or which get lost in some developers INBOX. I remember waiting months to see memory corruption fixes for a particular project I submitted by email to actually appear in the development repository. In some cases you really need to track your patches and prod someone to remind them about your contribution if need be. True, some of these issues are probably minor enough to not really hurt if they get lost, but I have a feel that a lot of minor things also sort of add up. This is where GitHub comes into play. We have had project hosting services since at least a decade now, but none of them (to my experience) have ever made it so easy for all involved parties to submit and merge changes into projects. Pull requests are just amazing. Well, at least for me, they are since a few months. I have a sort of mixed hate-love relationship with GitHub when it comes to a topic that is very important to me, Accessibility. The last project hosting site I really liked for their simple web interface (read, still usable with Lynx) was Google Code. That was in the days when Google still seemed to care about such things. These days, their newer services are next to unusable to me (with the tools I prefer). SourceForge was always a catastrophy. Many things were cumbersome to do, because the site is so loaded with links to all sorts of things I never need. However, at the time I was using it, all the things I really needed did work. GitHub is a different beast, in a different era of the internet. While I can read project pages and a few basic things perfectly fine, some parts of the GitHub site are simply unusable for no particular reason. For instance, I can edit (some of my) preferences and even save them. But I can not star a project, nor can I follow other developers. Invoking these links gives me a 404, which seems to indicate that some JavaScript (read, client side code execution) is required which my browser does not perform. However, I really wonder why. Because something like "I want to star this project" will eventually have to end up as a request on the server anyway, so it seems technically unnecessary to rely on Javascript for such an operation to succeed. Luckily, these days, hip projects do have an API. An GitHub is no exception. I want to emphasis that an API alone is not an accessibility fix, since you rarely have the time to implement a clinet for a random API, just to get access to a service you want to use. Sometimes you do, and an API is a great enabler in such situations, but a reference client with a rich feature-set is much better. I have to admit that I haven't evaluated any of the possible alternatives, but one client I found for GitHub's API did really boost my productivity in the last year. I am talking about Hub. It is a simple wrapper around Git that adds a few and enhances some other git commands. Most importantly, hub fork will fork the current checkout on GitHub, and hub pull-request allows you to quickly (and I really mean quickly!) open a pull request for some commits you've just done to your fork of some project. This is very helpful, and very accessible. While it does not solve all my accessibility problems with GitHub, it at least enables me to take part in the GitHub workflow. I can easily fork projects and submit pull reuqests for changes I did. And that is what I did, at least a bit, in roughly the past year. I am not sure exactly, but I think it was spring when someone made me aware of Hub. One approach would be to check my GitHub activity graph, but I probably don't have to mention that it is not accessible. Here is a list of some of my contributions to open source projects on GitHub since I discovered a good client for the GitHub API: To summarize: I love GitHub for what it does to the free software community. I think the simplicity (and transparency) of contributions is to the benefit of free and open source software. However, I also hate GitHub sometimes when I need to ask a friend to do relatively trivial changes for me. What I actually want, is a command-line client like Hub that makes most or even all functionality provided on the website available. True, some things like graphs are not immediately easy to adapt. But I really shouldn't need to use a modern full-fledged web browser to tell GitHub that I am interested in the activities of a certain user. Or delete a fork. Yes, thats right. I can use Hub to fork a project, but there is no way to delete it again. Sort of strange for casual small-scale contributions. I guess the workflow there is: fork, commit, pull-request, wait for merge, delete. I don't want to have all sorts of forks on GitHub that I actually don't actively use/maintain. So once a pull request was merged, and I don't have any other things I am working on right now, I actually want to get rid of the fork again. It is easy enough to do a fork should I ever need it again.

14 February 2014

Mario Lang: Type erasure

Andrzej's C++ blog has a nice series on type erasure. I found it interesting to read and have learnt some things from it. For instance, I vaguely guessed, but did not fully realize, that std::function<> is of course a performance hit, since the way how std::function<> is implemented makes it impossible for the compiler to do anything useful with that function call. Inlining is totally out of the question, since we have just erased the type information. You might say, "of course!", but for me it was sort of a revelation. The series is in four parts: part I, part II, part III, part IV.

12 February 2014

Mario Lang: Roughly 1500 source packages have possibly broken links in debian/control

There are currently roughly 1500 source packages in Debian which possibly (very likely actually) do have broken URLs in debian/control. While it is quite useful that we have VCS information and Homepage URLs in the Packages file these days, we also created a rather big source of bitrot. These URLs are typically paste-and-forget. Sure, people occasionally catch the fact that a homepage or VCS has moved, especially if they are active and in good contact with their upstreams. However, there are also other cases...
DUCK to the rescue! My coworker Simon Kainz has worked on a service that helps at least to track which URLs are currently broken. We've initially discussed some way to make this a part of Lintian, which is what I would have prefered. However, for good reasons, Lintian doesn't want to call out to the net by default, so these checks would likely not get run by many developers anyway. So Simon ended up creating DUCK - the Debian Url ChecKer which actually goes out to the net and verifies that all the Vcs-* and Homepage fields of debian/control are actually reachable. The frontend allows developers to search for packages they maintain, to quickly see if they have any URLs which are possibly broken. There is a slight chance of temporary network problems of course, so what DUCK does is to show the status of checks in the last few days, so that you quickly see if you are dealing with a typical false positive. First of all, thanks to Simon! I think DUCK is an excellent project for a future NM candidate. I actually already wanted to advocate him for DD, but we ended up on a website which suggested that new contributors should start by applying for DM these days, and only later go for DD. I find that actually quite strange, especially in Simons case, but well, we did not feel like argueing. Secondly, and thats also very important: whats needed to improve the overall quality of URLs in the package system is your attention! You can easily search for email addresses of maintainers or uploaders. Team members can create a bookmark entry that checks for problems in all packages maintained by the teams they are a member of. You just need to actually visit these pages from time to time. It would probably not be well received if we filed all these bugs at once :-). So we need you to care, since we don't want to generate too much noise regarding "just these broken URLs". Or are they? If your vcs fields are broken, debcheckout will not work properly. Which defeats the purpose of debcheckout. If your homepage URL is broken, packages.d.o will also have a wrong link. 1500 packages with broken URLs. Don't you think we can do better then that?

10 February 2014

Mario Lang: Neurofunkcasts

I have always loved Drum and Bass. In 2013 I rediscovered my love for Darkstep and Neurofunk, and found that these genres have developed quite a lot in the recent years. Some labels like Black Sun Empire and Evol Intent produce mixes/sets on a regular basis as podcasts these days. This article aggregates some neurofunk podcasts I like a lot, most recent first. Enjoy 33 hours and 57 minutes of fun with dark and energizing beats. Thanks to BSE Contrax and Evol Intent for providing such high quality sets. You can also see the Python source for the program that was used to generate this page.

8 February 2014

Mario Lang: Uploading Into and Downloading From The Universe

Have you ever wondered how new ideas, concepts, artworks etc. get into the Superconscious Collective of the universe, so that they then can be downloaded by exactly the right person who is meant to do something with them? yep, I, too, think that many of these ideas, concepts etc. come from the Great Unknown, where the seeds of limitless ideas and possibilities reside. But a lot of them also come from our own minds, from people who upload these things into the Superconscious Collective of our universe. Such ideas and concepts can be uploaded in several ways. Some of them are simply uploaded by a person who sources them, connects to the Superconscious Collective of the universe and streams them up. Others are maybe even uploaded by somebody virtually typing an article with their fingertips into the spread out hands or soles of the feet of their loved one, playfully teasing him/her and thereby streaming information into him/her, which s/he then again uploads, mainly subconsciously, into the Superconscious Collective of the universe. Once uploaded, all these limitless ideas and concepts become available to everyone and every living being, on Earth and throughout the whole universe. The thing is, that most people on Earth don't know how to consciously access information from there. Some do unconsciously and it again shows up in them as entirely new concepts and ideas, which they then spice with the flavor of their own essence and then stream them out into the world, be it as music, as software, as hardware, as artwork, as science and in limitless other ways. But it is also accessed by living beings throughout the whole universe, who also add their own ideas and concepts to the Great Superconscious Collective . Wanna know how to access this limitless information, ideas, concepts and/or possibilities from the Superconscious Collective? Just breathe, relax, expand ... expand and get into your biggest, greatest, awesomest being of you. Become all that you are, connected to everything. Now, consciously plug into the Great Superconscious Collective, the Great Cosmic Internet. Allow the ideas, information, possibilities stream into you and through you and look which ones you resonate with. Call them, feel them, let them land in you, and ask them what they want you to do with them, as you are the one who can express them in the highest possible way, otherwise they wouldn't have come to you in the first place. Then do one small thing to make them real in the world and watch them unfold. Or do whatever feels right for you to do, and create the most amazing new thing in the world.

Mario Lang: boost::python and boost::variant

I have unsuccessfully tried to find a solution for the following problem on the internet several times. Now that I have come at least closer to a usable approach, I thought I'd document what I have found so that others trying to achieve a similar thing can use this as a starting point. Boost.Python offers a very nice and flexible way to interface C++ data types with Python. With just a few lines of code, and the proper linker flags, you get a Python importable shared object from your C++ compiler. This can be very productive. However, there is one aspect of C++ data types that I couldn't figure out how to interface with Python, which are C++ discriminated unions, or more specifically, heterogeneous containers. While Python has no problems with containers containing objects of different types, C++ does not make this very easy by default. Usually the problem is solved with a container of pointers to a base class, and various subclasses with virtual functions. However, this approach is not always practical, especially if the different types of objects in an heterogeneous container dont have many things in common. This is where discriminated unions come to the rescue. They basically behave like a normal union in C, but have an additional field which indicates the type of object currently stored in the union. Boost.Variant does exactly that, with a nice visitor interface added on top of it.
Heterogeneous containers in C++ If we put the boost::variant<> template inside a STL container like std::vector<>, the result is a heterogeneous container. For the purpose of illustration, lets implement such a container. The example below is deliberately simple. In reality, the various types allowed in your variant will probably have more fields then just one.
#include <boost/variant.hpp>
#include <vector>
struct a   int x;  ;
struct b   std::string y;  ;
typedef boost::variant<a, b> variant;
typedef std::vector<variant> vector;
To ease creation of these two types of objects, we are going to write a few factory functions. We are going to wrap them in Python later on.
variant make_variant()   return variant();  
vector make_vector()   return vector a(), b(), a() ;  
Boost.Python Now lets create a Python module which exports the above functionality to Python.
#include <boost/python/class.hpp>
#include <boost/python/def.hpp>
#include <boost/python/implicit.hpp>
#include <boost/python/init.hpp>
#include <boost/python/module.hpp>
#include <boost/python/object.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
vector_indexing_suite apparently needs operator== defined on the value_type of the container. In our case, this is our boost::variant<a, b> type. Luckily, boost::variant<> already provides operator==. However, that operator== relies on operator== being defined for the underlying types. Since equality comparison is probably useful for other things as well, lets just create operator== for our two classes a and b.
bool operator==(a const &lhs, a const &rhs)   return lhs.x == rhs.x;  
bool operator==(b const &lhs, b const &rhs)   return lhs.y == rhs.y;  
Convert a boost::variant<> to PyObject * Boost.Python needs a way to convert our discriminated union to a Python object. This code relies on Python class definitions being present for all underlying variant types. We will define them later.
struct variant_to_object : boost::static_visitor<PyObject *>  
  static result_type convert(variant const &v)  
    return apply_visitor(variant_to_object(), v);
   
  template<typename T>
  result_type operator()(T const &t) const  
    return boost::python::incref(boost::python::object(t).ptr());
   
 ;
And finally, lets create our Python module.
BOOST_PYTHON_MODULE(bpv)  
  using namespace boost::python;
  class_<a>("a", init<a>()).def(init<>()).def_readwrite("x", &a::x);
  class_<b>("b", init<b>()).def(init<>()).def_readwrite("y", &b::y);
  to_python_converter<variant, variant_to_object>();
  implicitly_convertible<a, variant>();
  implicitly_convertible<b, variant>();
  def("make_variant", make_variant);
  class_<vector>("vector").def(vector_indexing_suite<vector, true>());
  def("make_vector", make_vector);
 
Compiling Lets create a shared object for Python.
$ g++ -std=c++11 -fPIC -shared $(python-config --includes) -o bpv.so file.cpp -lboost_python
Running We can load the module into Python and see what it does.
>>> import bpv
>>> variant=bpv.make_variant()
>>> variant
<bpv.a object at 0x7f06bb2130c0>
>>> variant.x
0
>>> variant.x=2
>>> variant.x
2
Nice. We can access the underlying type, and even modify it. Lets see how our heterogeneous container wrapping code behaves.
>>> vector=bpv.make_vector()
>>> vector
<bpv.vector object at 0x7f20693289d0>
>>> len(vector)
3
>>> list(vector)
[<bpv.a object at 0x7f20693190c0>, <bpv.b object at 0x7f20693193d0>, <bpv.a object at 0x7f2069319440>]
So far, so good. This will at least make it possible to convert heterogeneous containers from C++ to Python, which was my initial goal. Unfortunately, contained objects are not treated as references. Whenever retrieved, we get a copy. So in-place modification does not work.
>>> vector[0].x
0
>>> vector[0].x=2
>>> vector[0].x
0
However, we can override an existing element with a modified copy.
>>> e0=vector[0]
>>> type(e0)
<class 'bpv.a'>
>>> e0.x = 2
>>> vector[0] = e0
>>> vector[0].x
2
And we can also use the append and extend methods of Python containers.
>>> len(vector)
3
>>> vector.extend(vector)
>>> vector.append(bpv.a())
>>> len(vector)
7
>>> len(filter(lambda x: type(x)==bpv.b, vector))
2
>>> len(filter(lambda x: type(x)==bpv.a, vector))
5
>>> map(lambda x: x.x, filter(lambda x: type(x)==bpv.a, vector))
[2, 0, 2, 0, 0]
All that is missing for a perfect world is reference semantics for container elements. If anyone has a hint on how to achieve this, please let me know.

7 February 2014

Mario Lang: Solara: Fun with accessible RPGs on iOS

Solara is a fun turn-based fantasy strategy game for iOS which works perfectly well with VoiceOver. AppleVis has a review and all the details like a link into the AppStore. You build your castle level by level, and train your heroes to be stronger in battle. While your heroes are at battle, you can not control any real-time aspect of a battle. The combination of your heroes and their individual strengths (levels) is essential to determine if you can win a battle. So it sort of resembles rolling dice. At the beginning of a battle, you can choose which of your various heroes you'd like to send. You normally have four slots to fill, in earlier levels of Solara even less (to ease you into game play). Fighting is done in two different parts of the game. You need to use your heroes to solve quests, which will be rewarded by experience points and gold, which in turn will increase your playing level. From level 10 on, you will also be able to play in the arena against other player of solara. These arena fights are rewarded with arena points which in turn determine your place in an arena turnament. These turnaments usually last a few days. At the end, the top places are rewarded with gold. The way solara is structured makes it a perfect fit for VoiceOver. There are no real-time gesture problems to solve. It is basically an interactive text adventure with a fantasy theme and a weighted skills mechanism for determining the outcome of a fight. And luckily, the authors of solara realized this and did everything necessary to make this game really nicely playable with VoiceOver. My personal comment: I initially felt its implemented nicely, but playing it would be a waste of time. Now, a few months later, I am at level 39, and have seen hints that there are 50 levels in total. While I am not really hooked, I guess I will finish it eventually :-)

11 July 2010

Thorsten Glaser: Back home

Bordeaux was very nice (and towards the end much cooler it s actually hotter here at more than 50 north too warm to think, or do anything) but the LSM/RMLL was very french. They ll be in Stra burg and L ttich the next two years so we can probably be expected to attend. I don t think I can eat duck (which, in south-west france, is a vegetable) or like all that classic french multi-course food so much, but I had enough Couscous Merguez and Th la menthe fra che and similar good stuff. Many people spoke English and actually asked me whether I do (probably they couldn t bear me trying to spea^W^W^Wbutchering the language of the Grande Nation) and in general were a friendly bunch. I did see some people with machine guns in the city on the last day, though. No idea what/why didn t dare asking Just another reason to boycott flying: Mario Lang (one of the speakers) was apparently held on the airport and treated as a terrorist due to his Braille line they thought it was a bomb or somesuch thing.

Read on for more

6 February 2006

Enrico Zini: Italian screen reading

So far, it has been a fairly happy hacking day. I wanted to see how far I could go to make a Linux desktop accessible for the blind. Platform of choice is Breezy because:
  • it uses gnome, which is the most accessible stuff at the moment;
  • it's the distribution with the least amount of raw edges at the moment;
  • its gnome accessibility stuff is more up to date than the stuff in sid (I got in touch with Mario Lang and I'll see if I can help)
Step number 1: installing a fully working Breezy chroot inside my sid
  1. lvcreate -L2G -n breezy vg
  2. mkfs.jfs /dev/vg/breezy
  3. mount /dev/vg/breezy /chroot/breezy
  4. debootstrap --arch i386 breezy /chroot/breezy http://archive.ubuntu.com/ubuntu/
  5. chroot /chroot/breezy
  6. dpkg-reconfigure locales
  7. tzconfig
  8. base-config new
  9. fixed gdm configuration to work along with the sid X server
  10. fixed /etc/fstab, resolv.conf and /etc/hosts
  11. reduced the lart-delay of /etc/rcS.d/S04udev from 60 to 5 seconds
  12. "booted" the Breezy system running /etc/rcS and /etc/rc 2
Believe it or not, it works. I have another gdm login screen, I login and I hear the Ubuntu startup music. A couple of warnings about ACPI and HAL not working... well, I can imagine why. gnome-panel would refuse to show the menus. It turned out to be connected to Gnome bug #323064 (debian bug #338438) and I found out that Alt+F2 (run) and then killall gam_server would be enough to stay displayed.
Step number 2: getting the screen reader to work Note: the menu names might be incorrect as my system is localised in Italian and I'm now translating back to English.
  1. Install gnopernicus
  2. Go into Desktop/Preferences/Audio and disable the sound server
  3. Go into Desktop/Preferences/Assistive technology, enable assistive technology and screen reader
  4. Logout and in again
Now, coolness ubercoolness, the desktop starts to speak with the voice of a depressed 40 years old dude from the USA. Thanks to Luke Yelavich of ubuntu-accessibility for supporting me and for explaining me that if esd is running then the voice tends to disappear because esd steals the sound device to festival. He also explained me that if one tries to run festival through esd then it works, but since esd is a mixer then one starts hearing various voices for different events all mixed together. Now, the English speech engine often mentions the "barra dei sacramenti". In local Italian it means "toolbar for blaspheme curses". Time to move on to step 3.
Step number 3: getting the screen reader to work in Italian I'm very proud of the Italian speech engine that recently entered Debian thanks to Riccardo Vestrini and the Debian Italian Maintainers Task Force, I've already put it to good use in the past and have great plans about it for the future. It's now a good moment to turn the knowledge previously acquired with creative timewasting into something serious. So, on to work:
  1. get the italian festival voice packages from sid (the packages are festlex-ifd, festvox-itapc16k and festvox-italp16k)
  2. install them all in Breezy
  3. sudo patch /usr/share/festival/languages.scm /usr/share/doc/festlex-ifd/languages.scm.patch (and ping again Matthias Urlichs for a fix for bug#335845)
  4. log out
  5. kill all the festival servers, drivers and whatnot (need to do it when logged out, but one can just install the voices before starting gnopernicus for the first time)
  6. log in again
  7. go into gnopernicus configuration and select the new voices.
It SO WORKS! I configured some voices a bit at random, so now according to what I do the desktop speaks like the depressed dude, Adriano Celentano or the Italian dubbing of the Enterprise computer (without reverb effect). An extra cool unexpected side effect of this chroot setup is that now I can go back to my Sid X session and the Breezy X session will keep talking in the background, so I can even keep an ear on what happens in the other Virtual Console. Now, on to the applications. The menus, work. Abiword works, but I couldn't find out how to read the things I type on the editing area (not so useful until that one is solved). OpenOffice2 does not work. Firefox 1.5 works. gnome-terminal works. gedit works. It could be better, but I was fearing much worse. Now, gnopernicus has various powerful features accessible using the numeric keypad, but I haven't found a way to activate them in my laptop. It may be that with the keypad functions abiword becomes readable. I'm quite satisfied today.

Next.

Previous.